package com.heziguo.entity;

import java.io.Serializable;

/**
 * 
 * @ClassName:  Student 
 * @Package com.heziguo.entity    
 * @Description:学生类
 * @author: 贺子国 
 * @date:   2018年6月14日 下午11:03:35   
 *     
 * @Copyright: 2018 www.heziguo.com Inc. All rights reserved. 
 * 注意：
 */
public class Student implements Serializable,Comparable<Student>{

	/**  
	* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)  
	*/
	
	
	
	private static final long serialVersionUID = -1776475592649656931L;
	/**姓名 */
	private String name;
	/**成绩*/
	private int code;
	
	
	public Student(String name, int code) {
		super();
		this.name = name;
		this.code = code;
	}
	/**  
	 * @Title:  getName <BR>  
	 * @Description: please write your description <BR>  
	 * @return: String  name <BR>  
	 */
	public String getName() {
		return name;
	}
	/**  
	 * @Title:  setName <BR>  
	 * @Description: please write your description <BR>
	 *@param name 要设置的 name    
	 * @return: String <BR>  
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**  
	 * @Title:  getCode <BR>  
	 * @Description: please write your description <BR>  
	 * @return: int  code <BR>  
	 */
	public int getCode() {
		return code;
	}
	/**  
	 * @Title:  setCode <BR>  
	 * @Description: please write your description <BR>
	 *@param code 要设置的 code    
	 * @return: int <BR>  
	 */
	public void setCode(int code) {
		this.code = code;
	}
	/**   
	 * <p>Title: hashCode</p>   
	 * <p>Description: </p>   
	 * @return   
	 * @see java.lang.Object#hashCode()   
	 */  
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + code;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	/**   
	 * <p>Title: equals</p>   
	 * <p>Description: </p>   
	 * @param obj
	 * @return   
	 * @see java.lang.Object#equals(java.lang.Object)   
	 */  
	@Override
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		Student other = (Student) obj;
		if (code == other.code)
			return true;
		return false;
	}
	/**   
	 * <p>Title: toString</p>   
	 * <p>Description: </p>   
	 * @return   
	 * @see java.lang.Object#toString()   
	 */  
	@Override
	public String toString() {
		return "Student [name=" + name + ", code=" + code + "]";
	}
	@Override
	public int compareTo(Student o) {
		if (o == null)
			return -1;
		Student other = (Student) o;
		return (code < other.code) ? -1 : ((code == other.code) ? 0 : 1);
	}
	
	
}
